<?php
//------------------------------------------------------------------------------------------------------------------------------
//	Nom : article.php
//	Auteurs: Defondemieres Fabrice - Delfour Kevin
//	Description :
//------------------------------------------------------------------------------------------------------------------------------

include ('php/Lib_Stat.php');
include "charts.php";

 ini_set("error_reporting", E_ALL);
 ini_set("display_errors","1"); 
 ini_set("ignore_repeated_errors","1");
 ini_set("log_errors", "1" ); 
 ini_set("error_log", "articles/errors_statistique.txt" ); 

if (isset($_GET['article'])) {
	$target = $_GET["article"];
		$Echo_left = "<a href='article.php?article=$target'>Return to $target</a>";
		
    $moyenne = getmoyenne("$target");
    $nbmot = getnbMot();
    $max = getMax();
    $min = getMin();
    $ecart = getecartType();
    $variance = getvariance();
    $mediane = getmediane();
    $string = getminlocaux();
    $string = convertSymbols2Entities ($string);
    $string = Code2String($string);
    
    
		$data = art2xml("$target");
		if (file_exists("data/xml/$target.xml")) {
		    unlink("data/xml/$target.xml");
	    }
	  $fp = fopen ("data/xml/$target.xml", "w");
  	fseek ($fp, 0);
  	fputs ($fp, $data);
  	fclose ($fp);
		$Echo = "<div class=\"post\">
				      <h2 class=\"title\">Statistics</h2>
			        <p class=\"meta\">Explication : Ce graphes permet de visualiser les changements de paragraphes dans un article .<br/>Ces calculs sont effectués sur le principe du changement du vocabulaire dans deux paragraphes et determine si les paragraphes traitent du meme sujet ou non<br/></p>
				    <div class=\"entry\">
            <OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
              codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" 
              WIDTH=\"600\" 
              HEIGHT=\"450\" 
              id=\"charts\" 
              ALIGN=\"\">
              <PARAM NAME=movie VALUE=\"charts.swf?timeout=100&library_path=charts_library&xml_source=data/xml/$target.xml\">
              <PARAM NAME=quality VALUE=high>
              <PARAM NAME=bgcolor VALUE=#ffffff>
              
              <EMBED src=\"charts.swf?timeout=100&library_path=charts_library&xml_source=data/xml/$target.xml\"
                   quality=high 
                   bgcolor=#ffffff  
                   WIDTH=\"600\" 
                   HEIGHT=\"450\" 
                   NAME=\"charts\" 
                   ALIGN=\"Center\" 
                   swLiveConnect=\"true\" 
                   TYPE=\"application/x-shockwave-flash\" 
                   PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">
              </EMBED>
              </OBJECT></div>
              </div>  
              <ul>
                <li>Nombre de mots : $nbmot</li>
                <li>Min value : $min</li>
                <li>Max value : $max</li>
                <li>Moyenne : $moyenne</li>
                <li>Ecart type : $ecart</li>
                <li>Variance : $variance</li>
                <li>Mediane : $mediane</li>
                <li>Minimaux : $string</li>
              </ul>";
}

include ('template/top.tpl');
include ('template/main.tpl');
include ('template/back.tpl');
